import store from "@/store";
import api from '@/api';
import router from '../router'

if(localStorage.getItem("expireTime")){
    const item = JSON.parse(localStorage.getItem("expireTime"));
    const now = new Date();
    if (now.getTime() > item.expiry) {
        // 如果当前时间超过了过期时间，删除该项并返回 null
        localStorage.removeItem('expireTime');
        localStorage.removeItem('property');
        localStorage.removeItem('ctumb');
        alert("登录超时，请重新登陆");
    }
}

if(localStorage.getItem("property")){
    store.commit("login/setUser",JSON.parse(localStorage.getItem("property")))
}

if(localStorage.getItem("ctumb")){
    store.commit("ctumb/setCtumb",localStorage.getItem("ctumb"))
}